home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / lib / ubiquity / migration-assistant / ma-apply next >
Encoding:
Text File  |  2007-03-27  |  1.8 KB  |  76 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4. . /usr/share/debconf/confmodule
  5. . /usr/share/migration-assistant/ma-script-utils
  6. OLDIFS="$IFS"
  7. NEWLINE='
  8. '
  9. IFS="$NEWLINE"
  10.  
  11. if [ -z "$1" ]; then
  12.     mapath="/usr/bin"
  13. else
  14.     mapath="$1"
  15. fi
  16.  
  17.  
  18. db_get migration-assistant/partitions
  19. selection=`echo "$RET" | sed -e 's/, /\n/g'`
  20. for choice in $selection; # Microsoft Windows XP Professional (/dev/hda1)
  21. do
  22.     location=`expr "$choice" : '.*(\(.*\))'` # /dev/hda1
  23.     for line in `os-prober`;
  24.     do
  25.     loc=$(expr match "$line" '\(.*\):.*:.*:.*')
  26.     if [ "$location" = "$loc" ]
  27.     then
  28.         set_os_type "$line" || continue
  29.         path=${loc#*/*/}
  30.         IFS="$OLDIFS"
  31.         mount_os "$ostype" "$loc"
  32.         IFS="$NEWLINE"
  33.         db_get migration-assistant/$path/users
  34.         user_selection=`echo "$RET" | sed -e 's/, /\n/g'`
  35.         for usr in $user_selection;
  36.         do
  37.         formatted_user=`echo "$usr" | sed -e 's/ /:/g' | sed -e 's/,:/, /g'`
  38.         db_get migration-assistant/$path/$formatted_user/user
  39.         new_user=$RET
  40.  
  41.         if [ $(grep -c ^$new_user: $ROOT/etc/passwd) -eq 0 ]; then
  42.             log "creating user $new_user"
  43.  
  44.             db_get migration-assistant/new-user/$new_user/password
  45.             pass=$RET
  46.             db_get migration-assistant/new-user/$new_user/fullname
  47.             fn=$RET
  48.  
  49.             add_user $new_user $fn $pass
  50.         fi
  51.         
  52.         db_get migration-assistant/$path/$formatted_user/items
  53.         log "importing: $RET"
  54.         item_selection=`echo "$RET" | sed -e 's/, /\n/g'`
  55.         for itm in $item_selection;
  56.         do
  57.             itm=$(echo $itm | sed -e 's/ //g' | tr [A-Z] [a-z])
  58.             log-output -t migration-assistant $mapath/ma-import \
  59.             --target="$itm" \
  60.             --ostype="$ostype" \
  61.             --fromuser="$usr" \
  62.             --frompath="$mountpoint" \
  63.             --touser="$new_user" \
  64.             --topath="$ROOT" \
  65.             || error "importing $itm failed."
  66.         done
  67.         done
  68.  
  69.         IFS="$OLDIFS"
  70.         unmount_os
  71.         IFS="$NEWLINE"
  72.     fi
  73.     done
  74. done
  75.  
  76.